import settings

class MySQL:
    def __init__(self,ip,port):
        self.ip=ip
        self.port=port

    def func(self):
        print('%s:%s'(self.ip,self.port))

    @classmethod#绑定给类的方法
    def from_conf(cls):
        print(cls)
        return cls(settings.IP, settings.PORT)

obj=MySQL('1.1.1.1',3306)
print(obj.__dict__)
obj=MySQL.from_conf()

print(obj.__dict__)











